<%@ page import="java.util.ArrayList" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="template_header.jsp" />
<script type="text/javascript">

	var count = parseInt('${fundCount}');
	var abc = [];
	<c:forEach items="${fundYear}" var="item" varStatus="loop">
		abc['${loop.index}'] = "${item}";
	</c:forEach>
	
	var abc1 = ${fundPrice};
	google.load("visualization", "1", {
	packages : [ "corechart" ]
	});
	google.setOnLoadCallback(drawChart);

	function drawChart() {
		var data = new google.visualization.DataTable();
		data.addColumn('string', 'Date');
		data.addColumn('number', 'Price');
		data.addRows(count);

		for(var ii = 0; ii<count; ii++)
		{
			data.setCell(ii, 0, abc[ii]); 
			data.setCell(ii, 1, abc1[ii]);
		}
		
		var options = {
			title : '${fund.name}'
		};
		var chart = new google.visualization.LineChart(document
				.getElementById('chart_div'));
		chart.draw(data, options);
		
		var annotatedtimeline = new google.visualization.AnnotatedTimeLine(
			      document.getElementById('visualization'));
			  annotatedtimeline.draw(data, {'displayAnnotations': true});
	}
</script>
<div class="span9">
<jsp:include page="error-list.jsp" />
	<!-- /write your content -->
	<form method="post" action="openBuyFund.do">
		<input type="hidden" name="fundId" value="${fund.id}" />
		<div id="chart_div" style="width: 600px; height: 400px;"></div>
		<center>

			<input type="submit" value="Buy Fund" />

		</center>
	</form>
</div>
<!-- /end your content-->

<jsp:include page="template_tail.jsp" />
